//
//  StatusDetailViewFrame.m
//  Weibo
//
//  Created by Anasue on 9/16/15.
//  Copyright (c) 2015 Anasue. All rights reserved.
//

#import "StatusDetailViewFrame.h"
#import "Status.h"
#import "StatusOriginalViewFrame.h"
#import "StatusRetweetedViewFrame.h"

@implementation StatusDetailViewFrame

- (void)setStatus:(Status *)status
{
    _status = status;
    
    //原创微博frame
    StatusOriginalViewFrame *originalViewFrame = [[StatusOriginalViewFrame alloc]init];
    originalViewFrame.status = status;
    self.originalViewFrame = originalViewFrame;
    
    //转发微博frame
    CGFloat h = 0;
    if (status.retweeted_status) {
        StatusRetweetedViewFrame *retweetedViewFrame = [[StatusRetweetedViewFrame alloc]init];
        retweetedViewFrame.retweetedStatus = status.retweeted_status;
        
        //计算frame的y
        CGRect f = retweetedViewFrame.frame;
        f.origin.y = CGRectGetMaxY(originalViewFrame.frame);
        retweetedViewFrame.frame = f;
        self.retweetedViewFrame = retweetedViewFrame;
        h = CGRectGetMaxY(retweetedViewFrame.frame);
    }else{
        h = CGRectGetMaxY(originalViewFrame.frame);
    }
    
    //自己的frame
    CGFloat x = 0;
    CGFloat y = StatusCellInSet;
    CGFloat w = ScreenW;
    
    self.frame = CGRectMake(x, y, w, h);
}


@end
